import axios from "axios";

const base = "";

// 获取通话信息
export const DownFile = params => {
  return axios
    .get(`${base}/download?excelName=` + params.excelName, {
      responseType: "blob"
    })
    .then(res => {
      console.log(res);
      const blob = new Blob([res.data], {
        type: "application/xls"
      }); //处理文档流
      const fileName = params.excelName + ".xls";
      const elink = document.createElement("a");
      elink.download = fileName;
      elink.style.display = "none";
      elink.href = URL.createObjectURL(blob);
      document.body.appendChild(elink);
      elink.click();
      URL.revokeObjectURL(elink.href); // 释放URL 对象
      document.body.removeChild(elink);
    });
};
export const GetExcelList = params => {
  return axios.post(`${base}/getExcelList`, params).then(res => res.data);
};
export const GetExcelLists = params => {
  return axios.post(`${base}/getExcelLists`, params).then(res => res.data);
};
export const GetNowData = params => {
  return axios.post(`${base}/getNowData`, params).then(res => res.data);
};
export const GetDataFromDate = params => {
  return axios.post(`${base}/getDataFromDate`, params).then(res => res.data);
};
export const GetDataInfo = params => {
  return axios.post(`${base}/getDataInfo`, params).then(res => res.data);
};
export const GetYwInfo = params => {
  return axios.post(`${base}/getYwInfo`, params).then(res => res.data);
};
